﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Gnosis.Alexandria.Model.Factories
{
    public class GenericFactory<Concrete, Interface>
        : IFactory<Interface>
        where Interface : IIdentifiable
        where Concrete : Interface, new()
    {
        public GenericFactory(IRepository repository)
        {
            _repository = repository;
        }

        private IRepository _repository;

        #region IFactory<Interface> Members

        public Interface Create()
        {
            Concrete record = new Concrete();
            record.Repository = _repository;
            return record;
        }

        #endregion
    }
}
